﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/static/include/top.jsp"%>
<script>document.title="报表文件";</script>
	<table>
		<tbody>
			<tr>
				<th><img src="${ctx}/static/images/pages/cen/rig/ico_01.png " align="absmiddle">&nbsp;传送报表文件</th>
			</tr>
			<tr class="tab_grey">
				<td>
				<form name="uploadForm" target="upload" action="${baseURL}/data/uploadFile" method="post" enctype="multipart/form-data">
			<input type="file" name="uploadFile" id="upload">
			<span class="tab_text">简要说明：</span>
			<input name=attachExplain type="text" class="tab_textbut" id="attachExplain" size="30" />
			<a class="tab_but" href="#" onclick="uploadFile();return false;">上传</a>${msg }
			</form>
			
		<form name="searchForm" action="" method="get">
			<input type="hidden" name="p" value="1" />
			开始时间：
			<input
				id="searchDate" name="searchDate" onclick="calendar.show(this);"
				value="${formdata.startTime}" type="text"  class="tab_textbut" >
			<span class="tab_text">结束时间：</span>
			
			<input
				id="endDate" name="endDate" onclick="calendar.show(this);"
				value="${formdata.endTime}" type="text"  class="tab_textbut" >
			
			<a class="tab_but" href="#" onclick="searchForm.action='${baseURL}/company/data/transferReportList';searchForm.submit();return false;">查询</a>
			<a  class="tab_but" href="#" onclick="clearInput();return false;">清空</a>
			
			
		</form>
		<script>
		$("#attachExplain").val("${param['attachExplain']}");
		$("#searchDate").val("${param['searchDate']}");
		$("#endDate").val("${param['endDate']}");
		
		
		function clearInput() {
			$("#searchDate").val("");
			$("#endDate").val("");
			
		}
		</script>
		<iframe name="upload" width="0" height="0" frameborder="0"></iframe>
				</td>
			</tr>
		</tbody>
	</table>


  <br />
	<c:if test="${empty obj.operationResult}">
		<b>没有符合条件的记录。</b>
	</c:if>
<c:if test="${not empty obj.operationResult}">
  <table id="listTable">
  <tbody>
    <tr>
    	<th width="5%"><input type="checkbox" onclick="selectAll(this.checked);"></th>
        <th width="10%">附件名称</th>
		<th width="15%">上传时间</th>
		<th width="20%">上传单位</th>
		<th width="15%">简要说明</th>
		<th width="10%">处理状态</th>
		<th>操作</th>
		
    </tr>
    <c:forEach var="oneRow" items="${obj.operationResult}">
    		
    <tr>
    	<td class="tab_td_all" align="center"><input name="chk" type="checkbox" id="chk" value="${oneRow.attachId}" /></td>
      	<td align="left">${oneRow.attachFilename}</td>
		<td align="left">${oneRow.sysCreateDate}</td>
		<td align="left">${oneRow.userUnit}</td>
		<td align="left">${oneRow.attachExplain}</td>
		<td align="left">
		<c:if test="${oneRow.isDisposal==0}">未处理</c:if>
		<c:if test="${oneRow.isDisposal==1}">已处理</c:if>
		<c:if test="${oneRow.isDisposal==3}">通知</c:if>
		</td>
		<td align="left">
			<a href="${baseURL}/data/download?id=${oneRow.attachId}"><img src="${baseURL}/static/images/tab/ico_01.png" width="16" height="16" border="0" align="absmiddle"/>下载</a>
			
		</td>
		
    </tr>
    </c:forEach>
    <tr>
   <td  colspan="7">
    <a class="tab_but" onclick="delByIds('${ctx}')">批量删除</a></td>
     
    </tr>
    <tr class="tab_grey">
				<td colspan="7" align="center" valign="middle" class="tab_white">
				<div class="pagination"> 
					<%@ include file="../include/listpage.jsp"%>
				</div>
				<div class="clear"></div>
				</td>
			</tr>
    </tbody>
  </table>
<script>


function selectAll(checkAllFlag) {
	var checkArray = document.getElementsByName("chk");
	for (var i = 0; i < checkArray.length; i++) {
		checkArray[i].checked = checkAllFlag;
	}
}

function delByIds(prefix){
	
	var str="";
	var checkArray = document.getElementsByName("chk");
	for (var i = 0; i < checkArray.length; i++) {
		if(checkArray[i].checked){
			str += checkArray[i].value + ",";
		}
	}
	var dot = str.lastIndexOf(",");
	if(dot==-1){
		alert("请选择要删除的附件。");
		return;
	}else{
		str = str.substring(0,dot);
	}
	
	if(!window.confirm("确认删除？")){
		return;
	}
	
	var url=prefix+"/data/deleteMany";
	$.post(url,{"idStr":str,},function(data){
		alert("删除成功");
		location.reload(true);
	},'json');
	
}
function uploadFile(){
	if ($("#upload").val()==""){
		layer.alert("请选择文件。");
		return ;
	}
	uploadForm.submit();
}
</script>
</c:if>

<%@ include file="/static/include/bottom.jsp"%>
